package demo;

import java.util.Scanner;

/**
 * 找出水仙花数。
 */
public class Demo05 {
    public static void main(String[] args) {
        while (true) {
            System.out.println("请输入一个三位数:");
            Scanner sc = new Scanner(System.in);
            int i = sc.nextInt();
            boolean b = isSXH(i);
            if (b == true) {
                System.out.println(i + "是水仙花数");
            } else {
                System.out.println(i + "不是水仙花数");
            }
        }
    }

    public static boolean isSXH(int a) {
        int ge = a % 10;
        int shi = a / 10 % 10;
        int bai = a / 100;
        return (ge * ge * ge + shi * shi * shi + bai * bai * bai == a);
    }
}
